$(document).ready(function() {	
	$("#frmEdit").validate({
		errorClass		: 'errorMessage',
		errorElement	: 'span',
		onfocusout		: false,
		onkeyup			: false,
		rules: {			
			pname: {
				required			: true,
				minlength			: 5
			},
			pcontent: {
				required			: true,
				minlengthContent	: true
			}
		},
		messages: {	
			pname: {
				required			: name_required,
				minlength			: name_minlength
			},
			pcontent: {
				required			: content_required,
				minlengthContent	: content_minlength
			}
		},
		errorPlacement: function(label, element) {			
			var id = element.attr('id');	
			if (id == 'pcontent')	{
				label.insertAfter($('#pcontent___Frame'));
			}else if (id == 'pcontent_en')	{
				label.insertAfter($('#pcontent_en___Frame'));
			} else {
				label.insertAfter($('#' + id));			
			}
		},
		submitHandler: function(form) {				
			form.submit();
		}
	});	
	$.validator.addMethod('minlengthContent',function(){
		var oEditorContent 	= FCKeditorAPI.GetInstance('pcontent') ;
		var strContent		= stripTags(oEditorContent.GetXHTML( true ));		
		if(strContent != '' && strContent.length < 20)
			return false;		
		return true;												 
	});
});